home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / bash / bash_110 / mint / bash110s.zoo / bash-1.10 / support / mksysdefs < prev    next >
Encoding:
Text File  |  1991-07-25  |  4.9 KB  |  178 lines

  1. #!/bin/sh
  2. #
  3. # This file creates a file called "sysdefs.h" which contains CPP defines
  4. # helping to describe the operating system features.  We just take guesses
  5. # by looking at random files.
  6.  
  7. if [ "$1" ]; then
  8.   sysdefs=$1
  9. else
  10.   sysdefs=./sysdefs.h
  11. fi
  12.  
  13. rm -f $sysdefs
  14.  
  15. echo "/* sysdefs.h -- #defines for your system created by $0."       >>$sysdefs
  16. echo "   Do NOT EDIT this file, since any changes will disappear." >>$sysdefs
  17. echo "   Instead, edit $0, or config.h, or machines.h. */"       >>$sysdefs
  18. echo ""                                   >>$sysdefs
  19. echo "#if !defined (_SYSDEFS_H_)"                   >>$sysdefs
  20. echo "#  define _SYSDEFS_H_"                       >>$sysdefs
  21.  
  22. # Removes any inherited definitions.
  23. SHLIB=
  24. SYSDEF=
  25.  
  26. # Test for shared libraries (this is pretty Sunish).
  27. if test -f /lib/ld.so; then
  28.   SHLIB=-DHAVE_SHARED_LIBS
  29.   echo ""                    >>$sysdefs
  30.   echo "#define HAVE_SHARED_LIBS"        >>$sysdefs
  31. fi
  32.  
  33. # Test for shared libraries (this is pretty sVr4ish).
  34. if test -f /usr/ccs/lib/libc.so; then
  35.   if [ "$SHLIB" = "" ]; then
  36.     SHLIB=-DHAVE_SHARED_LIBS
  37.     echo ""                    >>$sysdefs
  38.     echo "#if !defined (HAVE_SHARED_LIBS)"    >>$sysdefs
  39.     echo "#  define HAVE_SHARED_LIBS"        >>$sysdefs
  40.     echo "#endif /* HAVE_SHARED_LIBS */"    >>$sysdefs
  41.   fi
  42.   SYSDEF=USGr4
  43. fi
  44.  
  45. # Get name of maintainer.
  46. if (whoami) >/dev/null 2>&1 && (hostname) >/dev/null 2>&1; then
  47.   WHOAMI=`whoami`@`hostname`;
  48. else
  49.   WHOAMI=`who am i | awk '{ print $1; }'`
  50. fi
  51.  
  52. if [ "$WHOAMI" = "" ]; then 
  53.   WHOAMI=`id | sed 's/uid=[01-9]*(//' | sed 's/) [) A-Za-z01-9(=,]*//'`
  54.   if (hostname) >/dev/null 2>&1; then
  55.     WHOAMI=$WHOAMI@`hostname`
  56.   elif test -f /usr/bin/uuname -o -f /bin/uuname; then
  57.     WHOAMI=`uuname -l`!$WHOAMI
  58.   fi
  59. fi
  60.  
  61. if [ "$WHOAMI" = "" ]; then
  62.   WHOAMI=root
  63. fi
  64.  
  65. echo ""                        >>$sysdefs
  66. echo "#if !defined (MAINTAINER)"        >>$sysdefs
  67. echo "#  define MAINTAINER $WHOAMI"        >>$sysdefs
  68. echo "#endif /* MAINTAINER */"            >>$sysdefs
  69.  
  70. # Try to locate ranlib.  I think this is a bad idea.
  71. if [ -r /usr/bin/ranlib ]; then RANLIB_LOCATION=/usr/bin/ranlib;
  72. elif [ -r /bin/ranlib ]; then RANLIB_LOCATION=/bin/ranlib;
  73. elif [ -r /usr/local/bin/ranlib ]; then RANLIB_LOCATION=/usr/local/bin/ranlib;
  74. elif [ -r /usr/local/gnubin/ranlib ]; then RANLIB_LOCATION=/usr/local/gnubin/ranlib;
  75. fi
  76.  
  77. # Does this system have /bin/csh?  We don't care about other csh's.
  78. if [ -f /bin/csh ]; then
  79.   echo ""                        >>$sysdefs
  80.   echo "#if !defined (HAVE_CSH)"             >>$sysdefs
  81.   echo "#  define HAVE_CSH"                >>$sysdefs
  82.   echo "#endif /* HAVE_CSH */"                 >>$sysdefs
  83. fi
  84.  
  85. if [ "${RANLIB_LOCATION}" ]; then
  86.   echo ""                        >>$sysdefs
  87.   echo "#if !defined (RANLIB_LOCATION)"         >>$sysdefs
  88.   echo "#  define RANLIB_LOCATION ${RANLIB_LOCATION}"    >>$sysdefs
  89.   echo "#endif /* RANLIB_LOCATION */"             >>$sysdefs
  90. fi
  91.  
  92. #
  93. # Is this a Xenix system?
  94. #
  95. if [ -f /xenix ]; then
  96.   SYSDEF="Xenix"
  97.  case "`uname -p`" in
  98.   *286) SYSDEF="Xenix286" ;;
  99.   *386) SYSDEF="Xenix386" ;;
  100.  esac
  101. fi
  102.  
  103. #
  104. # Is this a cadmus system?
  105. #
  106. if [ -f /unix ]; then
  107.   if [ -d /generic ]; then   # This is an AIX system.
  108.     SYSDEF="aixpc"
  109.     cat cpp-Makefile | grep -v '/\*\*/' >aix-Makefile
  110.   elif [ -d /etc/conf/kconfig.d ]; then     # This is a 386 running ISC?
  111.     SYSDEF="isc386"
  112.   elif [ -f /etc/xlc.cfg ]; then
  113.     if fgrep _IBMR2 /etc/xlc.cfg >/dev/null 2>&1; then
  114.       SYSDEF=RISC6000
  115.       cat cpp-Makefile | grep -v '/\*\*/' >aix-Makefile
  116.     fi
  117.   elif [ -f /bin/4d -a -f /bin/uname ]; then
  118.     case "`uname -r`" in
  119.       3.*) SYSDEF="Irix3" ;;
  120.       4.*) SYSDEF="Irix4" ;;
  121.       *)   SYSDEF="Irix3" ;;
  122.     esac
  123.   else
  124.     if [ "$SYSDEF" = "" ]; then
  125.       SYSDEF="cadmus"
  126.     fi
  127.  
  128.     if [ -f /shlib/libc_s ]; then
  129.       SHLIB=-DHAVE_SHARED_LIBS
  130.       echo ""                    >>$sysdefs
  131.       echo "#if !defined (HAVE_SHARED_LIBS)"    >>$sysdefs
  132.       echo "#  define HAVE_SHARED_LIBS"        >>$sysdefs
  133.       echo "#endif /* HAVE_SHARED_LIBS */"    >>$sysdefs
  134.     fi
  135.   fi
  136. fi
  137.  
  138. if [ "$SYSDEF" != "" ]; then
  139.   echo ""                    >>$sysdefs
  140.   echo "#if !defined ($SYSDEF)"            >>$sysdefs
  141.   echo "#  define $SYSDEF"            >>$sysdefs
  142.   echo "#endif /* $SYSDEF */"            >>$sysdefs
  143. fi
  144.  
  145. if [ -f /usr/include/unistd.h ]; then
  146.   echo ""                    >>$sysdefs
  147.   echo "#if !defined (HAVE_UNISTD_H)"        >>$sysdefs
  148.   echo "#  define HAVE_UNISTD_H"        >>$sysdefs
  149.   echo "#endif /* HAVE_UNISTD_H */"        >>$sysdefs
  150. fi
  151.  
  152. if [ -f /usr/include/sys/wait.h ]; then
  153.   echo ""                    >>$sysdefs
  154.   echo "#if !defined (HAVE_WAIT_H)"        >>$sysdefs
  155.   echo "#  define HAVE_WAIT_H"            >>$sysdefs
  156.   echo "#endif /* HAVE_WAIT_H */"        >>$sysdefs
  157. fi
  158.  
  159. if [ -f /usr/include/alloca.h ]; then
  160.   echo ""                    >>$sysdefs
  161.   echo "#if !defined (HAVE_ALLOCA_H)"        >>$sysdefs
  162.   echo "#  define HAVE_ALLOCA_H"        >>$sysdefs
  163.   echo "#endif /* HAVE_ALLOCA_H */"        >>$sysdefs
  164. fi
  165.  
  166. if [ -f /usr/include/sys/resource.h ]; then
  167.   echo ""                    >>$sysdefs
  168.   echo "#if !defined (HAVE_RESOURCE)"        >>$sysdefs
  169.   echo "#  define HAVE_RESOURCE"        >>$sysdefs
  170.   echo "#endif /* HAVE_RESOURCE */"        >>$sysdefs
  171. else
  172.   RESOURCE=
  173. fi
  174.  
  175. # These should be the last 2 lines in this file!
  176. echo ""                        >>$sysdefs
  177. echo "#endif /* _SYSDEFS_H_ */"            >>$sysdefs
  178.